#pragma once

#include "DestroyLinkAction.h"

#include "LinkEndDestructionData.h"

namespace uml {

DestroyLinkAction::DestroyLinkAction(const QString& umlType)
    : WriteLinkAction(umlType) {}

void DestroyLinkAction::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (json.isEmpty()) {
        return;
    }

    WriteLinkAction::fromJson(json, errorList);
    JsonSerializable::fromJsonArray(endDatas_, "endDatas", json, errorList);
}

void DestroyLinkAction::toJson(QJsonObject& json) {
    WriteLinkAction::toJson(json);
    JsonSerializable::toJsonArray(endDatas_, "endDatas", json);
}

/// <summary>
/// endDatas getter
/// The LinkEndData that the values of the Association ends for the links to be
/// destroyed.
/// </summary>
vector<shared_ptr<LinkEndDestructionData>>& DestroyLinkAction::endDatas() {
    return endDatas_;
}

} // namespace uml
